const mongoose = require('mongoose');
require('mongoose-long')(mongoose);
let schemaTypes = mongoose.Schema.Types;

//用户schema
let userSchema = new mongoose.Schema({
    _id: {
        type: mongoose.Schema.ObjectId,
    },
    //用户名
    name: {
        type: String,
        require: true // 不可为空约束
    },
    //用户密码
    pwd: {
        type: String,
        require: true
    },
    //创建时间
    crtime: {
        type: schemaTypes.Long,
        require: true
    },
    //更新时间
    chtime: {
        type: schemaTypes.Long,
        require: true
    },
    //用户权限
    region: {
        type: Number,
        require: true
    }
}, {
    versionKey: false
});

//用户模型
let UserModel = mongoose.model('UserModel', userSchema, 'acl_user');
module.exports = UserModel;